//
//  lianxirenTableViewCell.swift
//  BusinessIOS
//
//  Created by Rain on 2018/12/28.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class lianxirenTableViewCell: UITableViewCell {
    var nameLabel:UILabel!
    
    var nameTextField :UITextField!
    
    var bglabel:UILabel!
    
    var phoneLabel:UILabel!
    
    var phoneTextField :UITextField!
    
    var addButton : UIButton!
    
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        
    }
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
        
    }
    func lauoutUI(){
        
        nameLabel = UILabel()
        
        nameLabel.text = "联系人"
        nameLabel.textAlignment = .left
        nameLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        self.contentView.addSubview(self.nameLabel!)
        
        nameTextField = UITextField()
        //设置边框样式为圆角矩形
        nameTextField.borderStyle = UITextBorderStyle.none

        nameTextField.placeholder = "请输入姓名"
        nameTextField.textAlignment = .left
        self.contentView.addSubview(nameTextField)
        
        
        
        bglabel = UILabel()
        bglabel.backgroundColor = UIColor.groupTableViewBackground
        self.contentView.addSubview(self.bglabel!)
        

        
        phoneLabel = UILabel()
        phoneLabel.text = "联系电话"

        phoneLabel.textAlignment = .left
        phoneLabel.font = UIFont.systemFont(ofSize:12)//一般方法
        self.contentView.addSubview(self.phoneLabel!)
        
        phoneTextField = UITextField()
        //设置边框样式为圆角矩形
        phoneTextField.borderStyle = UITextBorderStyle.none
        phoneTextField.placeholder = "请输入联系电话"
        phoneTextField.textAlignment = .left
        self.contentView.addSubview(phoneTextField)
        
        
//        addButton = UIButton(type: UIButtonType.custom)
//        
//        
//        addButton.setImage(UIImage(named:"addButton"), for: .normal)
//        self.contentView.addSubview(self.addButton!)
        
        
        
        self.layoutView()
        
    }
    
    func layoutView() {
        
        self.nameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.left.equalTo(self.snp.left).offset(10)
            make.width.equalTo(80)
            make.height.equalTo(40)
        }
        
        self.nameTextField.snp.makeConstraints { (make) in
            make.top.equalTo(self.snp.top).offset(5)
            make.left.equalTo(self.nameLabel.snp.right).offset(5)
            make.right.equalTo(self.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
        self.bglabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.nameLabel.snp.bottom).offset(5)
            make.left.equalTo(self.snp.left).offset(0)
            make.right.equalTo(self.snp.right).offset(0)
            make.height.equalTo(0.5)
        }
        
        self.phoneLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.bglabel.snp.bottom).offset(5)
            make.left.equalTo(self.snp.left).offset(10)
            make.width.equalTo(80)
            make.height.equalTo(40)
        }
        
        self.phoneTextField.snp.makeConstraints { (make) in
            make.top.equalTo(self.bglabel.snp.bottom).offset(5)
            make.left.equalTo(self.phoneLabel.snp.right).offset(5)
            make.right.equalTo(self.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
//        self.addButton.snp.makeConstraints { (make) in
//            make.top.equalTo(self.snp.top).offset(5)
//            make.width.equalTo(40)
//            make.right.equalTo(self.snp.right).offset(-10)
//            make.height.equalTo(40)
//        }
        
        
        
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
